Figure 4A highlights the geomeTriD package, illustrating its ability to visualize 3D models derived from Dip-C, along with multiple genomic signals mapped onto single-cell 3D structures.
library(geomeTriD)
library(geomeTriD.documentation)
library(GenomicRanges)
library(TxDb.Hsapiens.UCSC.hg38.knownGene)
library(org.Hs.eg.db)
library(colorRamps)This data were downloaded from GEO with accession GSE117874. We will present the four supperloop anchors in chrX of GM12878 cell with segment and sphere style.
## set the data folder, all data are available in the extdata folder of this package
extdata <- system.file('extdata', 'GSE117874', package='geomeTriD.documentation')
hickit_3dg <- dir(extdata, '3dg', full.names = TRUE)
hickit <- import3dg(hickit_3dg, parental_postfix=c('a', 'b'))[[1]]
## split it into maternal and paternal 3D structures.
hickit.a <- hickit[hickit$parental=='a'] ## mat
hickit.b <- hickit[hickit$parental=='b'] ## pat
## delete the parental information
hickit.a$parental <- hickit.b$parental <- NULL
## set data range
range <- GRanges('X:1-155270560')
## prepare the coordinates for the four superloops.
supperloops <- GRanges(c('X:56800000-56850000',
'X:75350000-75400000',
'X:115000000-115050000',
'X:130850000-130900000'))
names(supperloops) <- c('ICCE', 'x75', 'DXZ4', 'FIRRE')
supperloops$label <- names(supperloops)
supperloops$col <- 2:5 ## set colors for each element
supperloops$type <- 'gene' ## set it as gene
## subset the data by given range
hickit.a <- subsetByOverlaps(hickit.a, range)
hickit.b <- subsetByOverlaps(hickit.b, range)
hickit.a <- alignCoor(hickit.a, hickit.b)
## prepare the backbone colors
resolution <- 3
backbone_colors <- matlab.like2(n=resolution*length(hickit.a))
## add the superloops as segments
c1 <- view3dStructure(hickit.a,
feature.gr=supperloops,
renderer = 'none',
region = range,
resolution=resolution,
show_coor=FALSE,
lwd.backbone = 0.25,
col.backbone = backbone_colors,
lwd.gene=6)
c2 <- view3dStructure(hickit.b,
feature.gr=supperloops,
renderer = 'none',
region = range,
resolution=resolution,
show_coor=FALSE,
lwd.backbone = 0.25,
col.backbone = backbone_colors,
lwd.gene=6)
c2 <- lapply(c2, function(.ele) { ## put pat to right pannel
.ele$side = 'right'
.ele
})
## view the data
threeJsViewer(c1, c2, title = c('GM12878 cell 3 mat', 'GM12878 cell 3 pat'))
#widget <-threeJsViewer(c1, c2, title = c('mat', 'pat'))
#tempfile <- 'Fig4.html'
#htmlwidgets::saveWidget(widget, file=tempfile)
#utils::browseURL(tempfile)
## view the superloops as spheres
addFeaturesAsSphere <- function(obj, features, ...){
backbone <- extractBackbonePositions(obj)
spheres <- createTADGeometries(features, backbone, ...)
c(obj, spheres)
}
mat <- view3dStructure(hickit.a, renderer = 'none', region = range,
resolution=resolution, show_coor=FALSE,
lwd.backbone = 0.25,
col.backbone = backbone_colors)
mat <- addFeaturesAsSphere(mat, supperloops, alpha = 0.5)
pat <- view3dStructure(hickit.b, renderer = 'none', region = range,
resolution=resolution, show_coor=FALSE,
lwd.backbone = 0.25,
col.backbone = backbone_colors)
mat <- addFeaturesAsSphere(mat, supperloops, alpha = 0.5)
pat <- addFeaturesAsSphere(pat, supperloops, alpha = 0.5)
showPairs(mat, pat, title = c('GM12878 cell 3 mat', 'GM12878 cell 3 pat'))
## load the processed data.
hickit.a <- readRDS(file.path(extdata, 'hickit.a.rds'))
hickit.b <- readRDS(file.path(extdata, 'hickit.b.rds'))
widgets <- mapply(function(a, b, i){
mat <- view3dStructure(a, renderer = 'none', region = range,
resolution=resolution, show_coor=FALSE, lwd.backbone = 0.25,
col.backbone = backbone_colors)
mat <- addFeaturesAsSphere(mat, supperloops, alpha = 0.5)
pat <- view3dStructure(b, renderer = 'none', region = range,
resolution=resolution, show_coor=FALSE, lwd.backbone = 0.25,
col.backbone = backbone_colors)
pat <- addFeaturesAsSphere(pat, supperloops, alpha = 0.5)
showPairs(mat, pat, title = paste('cell', i, c('mat', 'pat')),
background = c("#11111188",
"#222222DD",
"#222222DD",
"#11111188"))
}, hickit.a, hickit.b, names(hickit.a), SIMPLIFY = FALSE)
widgets[[1]]
widgets[[2]]## R version 4.5.1 (2025-06-13)
## Platform: x86_64-pc-linux-gnu
## Running under: Ubuntu 24.04.2 LTS
##
## Matrix products: default
## BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
## LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.26.so; LAPACK version 3.12.0
##
## locale:
## [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
## [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
## [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
## [7] LC_PAPER=en_US.UTF-8 LC_NAME=C
## [9] LC_ADDRESS=C LC_TELEPHONE=C
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
##
## time zone: Etc/UTC
## tzcode source: system (glibc)
##
## attached base packages:
## [1] grid stats4 stats graphics grDevices utils datasets
## [8] methods base
##
## other attached packages:
## [1] colorRamps_2.3.4
## [2] org.Hs.eg.db_3.21.0
## [3] TxDb.Hsapiens.UCSC.hg38.knownGene_3.21.0
## [4] GenomicFeatures_1.61.4
## [5] AnnotationDbi_1.71.0
## [6] Biobase_2.69.0
## [7] GenomicRanges_1.61.1
## [8] Seqinfo_0.99.1
## [9] IRanges_2.43.0
## [10] S4Vectors_0.47.0
## [11] BiocGenerics_0.55.0
## [12] generics_0.1.4
## [13] geomeTriD.documentation_0.0.4
## [14] geomeTriD_1.3.14
##
## loaded via a namespace (and not attached):
## [1] strawr_0.0.92 RColorBrewer_1.1-3
## [3] rstudioapi_0.17.1 jsonlite_2.0.0
## [5] magrittr_2.0.3 farver_2.1.2
## [7] rmarkdown_2.29 fs_1.6.6
## [9] BiocIO_1.19.0 ragg_1.4.0
## [11] vctrs_0.6.5 memoise_2.0.1
## [13] Rsamtools_2.25.1 RCurl_1.98-1.17
## [15] base64enc_0.1-3 htmltools_0.5.8.1
## [17] S4Arrays_1.9.1 progress_1.2.3
## [19] plotrix_3.8-4 curl_6.4.0
## [21] Rhdf5lib_1.31.0 rhdf5_2.53.1
## [23] SparseArray_1.9.0 Formula_1.2-5
## [25] sass_0.4.10 parallelly_1.45.0
## [27] bslib_0.9.0 htmlwidgets_1.6.4
## [29] desc_1.4.3 Gviz_1.53.1
## [31] httr2_1.1.2 cachem_1.1.0
## [33] GenomicAlignments_1.45.1 igraph_2.1.4
## [35] lifecycle_1.0.4 pkgconfig_2.0.3
## [37] Matrix_1.7-3 R6_2.6.1
## [39] fastmap_1.2.0 MatrixGenerics_1.21.0
## [41] future_1.58.0 aricode_1.0.3
## [43] clue_0.3-66 digest_0.6.37
## [45] colorspace_2.1-1 textshaping_1.0.1
## [47] Hmisc_5.2-3 RSQLite_2.4.1
## [49] filelock_1.0.3 progressr_0.15.1
## [51] httr_1.4.7 abind_1.4-8
## [53] compiler_4.5.1 bit64_4.6.0-1
## [55] backports_1.5.0 htmlTable_2.4.3
## [57] BiocParallel_1.43.4 DBI_1.2.3
## [59] R.utils_2.13.0 biomaRt_2.65.0
## [61] MASS_7.3-65 rappdirs_0.3.3
## [63] DelayedArray_0.35.2 rjson_0.2.23
## [65] tools_4.5.1 foreign_0.8-90
## [67] future.apply_1.20.0 nnet_7.3-20
## [69] R.oo_1.27.1 glue_1.8.0
## [71] restfulr_0.0.16 dbscan_1.2.2
## [73] InteractionSet_1.37.0 rhdf5filters_1.21.0
## [75] checkmate_2.3.2 cluster_2.1.8.1
## [77] gtable_0.3.6 BSgenome_1.77.1
## [79] trackViewer_1.45.1 R.methodsS3_1.8.2
## [81] ensembldb_2.33.1 data.table_1.17.6
## [83] hms_1.1.3 xml2_1.3.8
## [85] XVector_0.49.0 RANN_2.6.2
## [87] pillar_1.10.2 stringr_1.5.1
## [89] dplyr_1.1.4 BiocFileCache_2.99.5
## [91] lattice_0.22-7 deldir_2.0-4
## [93] rtracklayer_1.69.1 bit_4.6.0
## [95] biovizBase_1.57.1 tidyselect_1.2.1
## [97] Biostrings_2.77.2 knitr_1.50
## [99] gridExtra_2.3 ProtGenerics_1.41.0
## [101] SummarizedExperiment_1.39.1 xfun_0.52
## [103] matrixStats_1.5.0 stringi_1.8.7
## [105] UCSC.utils_1.5.0 lazyeval_0.2.2
## [107] yaml_2.3.10 evaluate_1.0.4
## [109] codetools_0.2-20 interp_1.1-6
## [111] tibble_3.3.0 cli_3.6.5
## [113] rpart_4.1.24 systemfonts_1.2.3
## [115] jquerylib_0.1.4 dichromat_2.0-0.1
## [117] Rcpp_1.0.14 GenomeInfoDb_1.45.6
## [119] globals_0.18.0 grImport_0.9-7
## [121] dbplyr_2.5.0 png_0.1-8
## [123] XML_3.99-0.18 parallel_4.5.1
## [125] pkgdown_2.1.3 rgl_1.3.24
## [127] ggplot2_3.5.2 blob_1.2.4
## [129] prettyunits_1.2.0 jpeg_0.1-11
## [131] latticeExtra_0.6-30 AnnotationFilter_1.33.0
## [133] bitops_1.0-9 txdbmaker_1.5.6
## [135] listenv_0.9.1 VariantAnnotation_1.55.1
## [137] scales_1.4.0 crayon_1.5.3
## [139] rlang_1.1.6 KEGGREST_1.49.1